<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use App\User;
use Illuminate\Support\Facades\Redis;
class ModifyUserPasswd extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'modify:user_password {mobile} {password}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '修改用户密码';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $mobile = $this->argument('mobile');
        $password = bcrypt(md5($this->argument('password')));
        if(!$mobile){
            return;
        }
        $user = User::where('mobile',$mobile)->update(['password'=>$password]);
        $this->info('修改成功');
    }
}
